package cn.kgc.se.day06.work;

/**
 * @author 课工场
 * @date 2024/3/21
 * @description 使用if选择结构对三个整数进行排序，输出时按照从小到大的顺序输出
 * <p>
 * int  a = 10
 * int  b = 20
 * int  c = 5
 * <p>
 * 假定 a中存储最小的数据  c中存储最大数据     a<b<c
 */
public class Demo03 {

    public static void main(String[] args) {

        int a = 20;
        int b = 10;
        int c = 5;

        //  a>b
        if (a > b) {
            a = a + b;
            b = a - b;
            a = a - b;
        }

        // a>c

        if (a > c) {
            a = a + c;
            c = a - c;
            a = a - c;
        }

        // 经过以上两步  a中存储的就是最小值   b > c
        if (b>c){
            b = b+c;
            c = b-c;
            b = b-c;
        }


        System.out.println(a+"<"+b+"<"+c);

    }
}
